package com.xinxin.siteset.controller;

import com.xinxin.siteset.model.Classification;
import com.xinxin.siteset.service.ClassificationService;
import com.xinxin.siteset.utils.ResponseUtil;
import com.xinxin.siteset.vo.ClassificationParam;
import com.xinxin.siteset.vo.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 史鑫鑫
 * @date Created in 2019/6/7 3:01
 */
@RestController
@RequestMapping("/v1/api")
public class ClassificationController {
    @Autowired
    ClassificationService classificationService;

    @PostMapping("/classification")
    public Response allclassification(@RequestBody ClassificationParam classificationParam) {
        Classification classification = new Classification();
        classification.setUserId(1L);
        classification.setClassificationName(classificationParam.getClassificationName());
        return ResponseUtil.success(classificationService.insert(classification));
    }
}
